<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class FangsRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'fang_name' => 'required',
            'fang_xiaoqu' => 'required',
            'fang_province' => 'numeric|min:1',
            'fang_city' => 'numeric|min:1',
            'fang_region' => 'numeric|min:1',
            'fang_addr' => 'required',
            'fang_desn' => 'required'
        ];
    }

    //获取已定义验证规则的错误消息
    public function messages()
    {
        return [
            'fang_name.required' => '请输入房源名称',
            'fang_xiaoqu.required' => '请输入小区名称',
            'fang_province.min' => '请选择一个省份',
            'fang_city.min' => '请选择市',
            'fang_region.min' => '请选择县或者区',
            'fang_addr.required' => '请填写地址',
            'fang_desn.required' => '请填写描述信息'
        ];
    }



}
